Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-stream

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-stream

Check if something is a Node.js stream

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
30M
decreased by-62.51%
Maintainers
1
Weekly downloads
 
Created

What is is-stream?

The is-stream npm package is a simple utility used to check if an object is a Node.js stream. It can differentiate between readable, writable, duplex (both readable and writable), and transform (a type of duplex stream) streams. This package is useful when you need to validate that a given object conforms to the stream interface expected by Node.js APIs.

What are is-stream's main functionalities?

Check if an object is a stream

This feature allows you to check if a given object is a Node.js stream.

const isStream = require('is-stream');

isStream(process.stdin); // true
isStream({}); // false

Check if a stream is readable

This feature allows you to check if a stream is a readable stream.

const isStream = require('is-stream');

isStream.readable(process.stdin); // true
isStream.readable(process.stdout); // false

Check if a stream is writable

This feature allows you to check if a stream is a writable stream.

const isStream = require('is-stream');

isStream.writable(process.stdout); // true
isStream.writable(process.stdin); // false

Check if a stream is a duplex stream

This feature allows you to check if a stream is a duplex stream, which is both readable and writable.

const isStream = require('is-stream');
const { Duplex } = require('stream');

const duplexStream = new Duplex();
isStream.duplex(duplexStream); // true
isStream.duplex(process.stdin); // false

Check if a stream is a transform stream

This feature allows you to check if a stream is a transform stream, which is a type of duplex stream with additional functionality.

const isStream = require('is-stream');
const { Transform } = require('stream');

const transformStream = new Transform();
isStream.transform(transformStream); // true
isStream.transform(process.stdin); // false

Other packages similar to is-stream

Keywords

FAQs

Package last updated on 12 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc